package com.demo.webflux.simple3;

import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;

import com.demo.webflux.domain.Book;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

public interface ReactiveSpringDataMongoBookRepository extends ReactiveMongoRepository<Book, Integer> {

	Flux<Book> findByAuthorsOrderByPublishYearDesc(Flux<String> authors);

	@Query("{ 'authors.1': {$exists: true} }")
	Flux<Book> booksWithFewAuthors();

	Mono<Book> findOneByTitle(Mono<String> title);

	Flux<Book> findByAuthor(String author, Pageable pageable);

}
